package com.student.xujiang.mysmalluse.companylogin.model;

import android.content.Context;
import android.content.pm.PackageManager;

/**
 * Created by xujiang on 2017/3/21.
 */

public class LoginRequest {
    private String account;
    private String password;
    private int OS;  //0为android
    private String appVersion;
    private int appVersionCode;
    private String devToken;
    private String userID;

    public LoginRequest(String account, String password, int OS, String appVersion, int appVersionCode,
                 String devToken,String userID) {
        this.account = account;
        this.password = password;
        this.OS = OS;
        this.appVersion = appVersion;
        this.appVersionCode = appVersionCode;
        this.devToken = devToken;
        this.userID = userID;
    }

    public LoginRequest(Context context, String account, String password, String devToken) {
        this.account = account;
        this.password = password;
        this.devToken = devToken;
        this.OS = 0;
        this.userID = "";
        try {
            this.appVersion = context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionName;
            this.appVersionCode = context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            this.appVersion = "1.0";
            this.appVersionCode = 10;
        }
    }



    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }


    public String getDevToken() {
        return devToken;
    }

    public void setDevToken(String devToken) {
        this.devToken = devToken;
    }

    public int getOS() {
        return OS;
    }

    public void setOS(int OS) {
        this.OS = OS;
    }

    public int getAppVersionCode() {
        return appVersionCode;
    }

    public void setAppVersionCode(int appVersionCode) {
        this.appVersionCode = appVersionCode;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        userID = userID;
    }

    @Override
    public String toString() {
        return "Login{" +
                "account='" + account + '\'' +
                ", password='" + password + '\'' +
                ", OS=" + OS +
                ", appVersion='" + appVersion + '\'' +
                ", appVersionCode=" + appVersionCode +
                ", devToken='" + devToken + '\'' +
                ", UserID='" + userID + '\'' +
                '}';
    }
}
